AddPrefabPostInit('lightninggoatherd',function (inst)
    if not TheWorld.ismastersim then
        return inst
    end
    local fx = nil
    ---@cast fx ent_fx
    inst:DoPeriodicTask(1,function()
        local pt = inst:GetPosition()
        if fx == nil or not fx:IsValid() then
            fx = SpawnPrefab('fx_webbert_misc')
            ---@cast fx ent_fx
            -- fx:fn_fx_webbert_misc('reticuleaoe','reticuleaoe','idle_target_1d2',true,false,.7,true,pt)
            fx:fn_fx_webbert_misc('goat_avatar','goat_avatar','idle',true,false,.6,true,pt)
            fx.AnimState:SetLightOverride(1)
            fx.AnimState:SetLayer(LAYER_WORLD_BACKGROUND)
        end
        fx.Transform:SetPosition(pt:Get())
    end)
    inst:ListenForEvent('onremove',function()
        if fx and fx:IsValid() then
            fx:Remove()
            fx = nil
        end
    end)
end)

AddPrefabPostInit('lightninggoat',function (inst)
    if not TheWorld.ismastersim then
        return inst
    end
    local fx = nil
    ---@cast fx ent_fx
    inst:DoPeriodicTask(1,function()
        local herd = inst.components.herdmember and inst.components.herdmember:GetHerd()
        if (fx == nil or not fx:IsValid()) and herd then
            fx = SpawnPrefab('fx_webbert_misc')
            ---@cast fx ent_fx
            fx:fn_fx_webbert_misc('reticulelong','reticulelong','idle',true,false,1,true)
            fx.AnimState:SetLayer(LAYER_WORLD_BACKGROUND)
            fx.AnimState:SetScale(.4,.7,1)
            -- fx.entity:SetParent(inst.entity)
            fx.entity:AddFollower()
            fx.Follower:FollowSymbol(inst.GUID, nil, 0, 0, 0)
        end
        if herd then
            local pt = herd:GetPosition()
            fx:ForceFacePoint(pt:Get())
        end
    end)
    inst:ListenForEvent('onremove',function()
        if fx and fx:IsValid() then
            fx:Remove()
            fx = nil
        end
    end)
end)